<?php

namespace app\core\controller;

use think\Controller;


class Core extends Controller
{


    public function widget()
    {
        $name = input('name');
        $name = str_replace(',', '/', $name);
        $data = input();

        return json(widget($name, $data));
    }

    public function load()
    {

        $info = str_replace([config('var_pathinfo') . '=', '/load/'], '', $_SERVER['QUERY_STRING']);
        $arr = explode('.', $info);
        $ext = end($arr);
        switch ($ext) {
            case 'css' :
                header('Content-type: text/css');
                break;
            case 'js':
                header('Content-type: text/javascript');
                break;
            default :
        }

        $path = \think\facade\App::getAppPath() . $info;
        if (is_file($path)) {
            exit(file_get_contents($path));
        }
        echo "";
    }


}
